import $http from '@/assets/js/http'

//获取历史搜索记录
export function getHistoryseach(userId){
    return $http.get('/api/index/search/history',{
        params:{
            userId:userId,
        }
    });
}

//请求搜索
export function postSearch(userId,keywords,pageIndex,pageSize,lang){
    return $http.post('/api/index/search',{
        userId:userId,
        keywords:keywords,
        pageIndex:pageIndex,
        pageSize:pageSize,
        lang:lang,
    });
}

//清空历史搜索
export function postclearHistory(userId,lang){
    return $http.post('/api/index/search/history/clear',{
            userId:userId,
            lang:lang
    });
}

//获取一级分类列表
export function getFirstType(lang){
    return $http.get('/api/index/category/list',{
        params:{
            lang:lang,
        }
    });
}

//获取二级子分和三级列表
export function getSecondType(categoryId,lang){
    return $http.get('/api/index/category/children',{
        params:{
            categoryId:categoryId,
            lang:lang,
        }
    });
}

//获取具体某个分类下的商品列表
export function getGoodList(categoryId,pageIndex,pageSize,lang){
    return $http.get('/api/index/categoryGoodsList',{
        params:{
            categoryId:categoryId,
            pageIndex:pageIndex,
            pageSize:pageSize,
            lang:lang,
        }
    });
}
// ************下面三个是我加的******************
//查看首页更多推荐
export function getRecommendList(categoryId,pageIndex,pageSize,lang){
    return $http.get('/api/index/recommendList',{
        params:{
            categoryId:categoryId,
            pageIndex:pageIndex,
            pageSize:pageSize,
            lang:lang,
        }
    });
}
//查看首页每周精选
export function getHotList(categoryId,pageIndex,pageSize,lang){
    return $http.get('/api/index/hotList',{
        params:{
            categoryId:categoryId,
            pageIndex:pageIndex,
            pageSize:pageSize,
            lang:lang,
        }
    });
}
//查看首页最新发布
export function getNewList(categoryId,pageIndex,pageSize,lang){
    return $http.get('/api/index/newList',{
        params:{
            categoryId:categoryId,
            pageIndex:pageIndex,
            pageSize:pageSize,
            lang:lang,
        }
    });
}